
#pragma once

#include "Main/BaseObject.h"
#include "Math/Math3d.h"
#include "tinyxml/tinyxml.h"
#include "Stl/STLvector.h"
#include "Renderer/OpenGL.h"

typedef enum{
	HRK_UNKNOWN = -1,
	HRK_ROOT = 0,
	HRK_NODE,
	HRK_BONE,
	HRK_MESH,
	HRK_SUBMESH,
	HRK_LIGHT,
	HRK_HELPER,
	HRK_CAMERA
}HrkObType;

class CHrkNode;

class CHrkObject:public CBaseObject
{
	DECLARE_DYNCREATE( CHrkObject ) 
public:

	std::string m_name;

	int m_slot;
	CHrkObject* m_parent;

	GLvec3f m_translate1;
	GLvec3f m_rotate1;
	GLvec3f m_scale1;

	GLvec3f m_translate;
	GLvec3f m_rotate;
	GLvec3f m_scale;

	GLmat4f m_mat;
	GLmat4f m_mat_comb;

	HrkObType m_ob_type;

protected:
	long m_RefCount ;


public:
	CHrkObject();
	~CHrkObject();
	
	int GetSlotIndex();
	int FindSlotIndex();

	void AddRef();
	int GetRefCount();
	void Release();

	virtual void UpdateTransform();
	virtual void ParseScript( TiXmlElement* elem );
	virtual void Destroy();
};

HrkObType StrType2Hrk( const TCHAR* sType );
CHrkNode* MakeHrkNode( HrkObType type );